package bean;

public class Grade implements Comparable<Grade>{
	private ObjectId _id;
	
	private Integer student_id;
	
	private String type;
	
	private Double score;

	public ObjectId get_id() {
		return _id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((_id == null) ? 0 : _id.hashCode());
		result = prime * result + ((score == null) ? 0 : score.hashCode());
		result = prime * result
				+ ((student_id == null) ? 0 : student_id.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Grade other = (Grade) obj;
		if (_id == null) {
			if (other._id != null)
				return false;
		} else if (!_id.equals(other._id))
			return false;
		if (score == null) {
			if (other.score != null)
				return false;
		} else if (!score.equals(other.score))
			return false;
		if (student_id == null) {
			if (other.student_id != null)
				return false;
		} else if (!student_id.equals(other.student_id))
			return false;
		if (type == null) {
			if (other.type != null)
				return false;
		} else if (!type.equals(other.type))
			return false;
		return true;
	}

	public void set_id(ObjectId _id) {
		this._id = _id;
	}

	public Integer getStudent_id() {
		return student_id;
	}
	
	@Override
	public int compareTo(Grade otherObj) {
		return this.getStudent_id().compareTo(otherObj.getStudent_id());
	}

	@Override
	public String toString() {
		return "Grade [_id=" + _id + ", student_id=" + student_id + ", type="
				+ type + ", score=" + score + "]";
	}

	public void setStudent_id(Integer student_id) {
		this.student_id = student_id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Double getScore() {
		return score;
	}

	public void setScore(Double score) {
		this.score = score;
	}

}
